package com.gtworldmobile.dialogs;


import org.mixare.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;

public class EventoDialog extends Activity{

public static final String COMENTARIO_RESULT = "COMENTARIO_ESCRITO";
private Button comentar;
private Button cancelar;
private EditText comentario;
private String coment;

@Override
public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);		
		setContentView(R.layout.evento_dialog);
		
		Bundle extras = getIntent().getExtras();
        
        if(extras !=null)
        {
        	coment = extras.getString("coment");
        }
		
		comentar = (Button)findViewById(R.id.comentar);
		comentar.setOnClickListener(new OnClickListener(){
			public void onClick(View v) {
				returnComent();
			}
		});
		cancelar = (Button)findViewById(R.id.cancelar);
		cancelar.setOnClickListener(new OnClickListener(){
			public void onClick(View v) {
				cancelDialog();
			}
		});
		
		comentario = (EditText)findViewById(R.id.comentario);
		comentario.setText(coment);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
				WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
	
	}

	private void returnComent(){
		Intent resultIntent = new Intent(this, EventoDialog.class);
		resultIntent.putExtra(COMENTARIO_RESULT, comentario.getText().toString());
		setResult(Activity.RESULT_OK, resultIntent);
		finish();
		
	}

	private void cancelDialog(){
		finish();
	}
}
